package com.fcscs.ecms.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fcscs.cservice.domain.MainMenuItem;
import com.fcscs.cservice.domain.Versions;
import com.fcscs.cservice.domain.model.EntityVersionView;
import com.fcscs.cservice.domain.model.MainMenuItemView;
import com.fcscs.cservice.ws.schema.common.InfoDetailView;
import com.fcscs.cservice.ws.schema.common.InfoMasterView;
import com.fcscs.cservice.ws.schema.common.InfoMenuListView;
import com.fcscs.cservice.ws.schema.common.MenuListView;
import com.fcscs.cservice.ws.schema.common.PictureFrameView;
import com.fcscs.ecms.dao.ECMSInfoDao;
import com.fcscs.ecms.dao.ECMSMainMenuDao;
import com.fcscs.ecms.dao.hibernate.ECMSInfoDaoHibernate;
import com.fcscs.ecms.service.ECMSInfoManager;
import com.fcscs.ecms.service.ECMSMainMenuManager;
@Service("ecmsInfoManager")
public class ECMSInfoManagerImpl  implements ECMSInfoManager{
	@Autowired
	ECMSInfoDao ecmsInfoDao;
	@Autowired 
	ECMSMainMenuDao ecmsMainMenuDao;
	@Override
	public boolean copyVersion(Versions fromVer, Versions toVer) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public List<EntityVersionView> getEntityVersionViewList(long orgId,
			long propId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public InfoMasterView getInfoMasterView(long orgId, long propId,
			String langId , long id) {
		// TODO Auto-generated method stub
		InfoMasterView infoMasterView = ecmsInfoDao.getInfoMasterView(orgId, propId, langId ,id);
		System.out.println(infoMasterView.getPictureFrameView().getId());
		PictureFrameView pictureFrameView = ecmsMainMenuDao.getPictureFrameViews(orgId, propId, infoMasterView.getPictureFrameView().getId());
		infoMasterView.setPictureFrameView(pictureFrameView);
		return infoMasterView;

	}

	

	

	@Override
	public List<InfoMenuListView> getMasterInfoMenuListView(long orgId,
			long propId, String langId, List<Long> id) {
		// TODO Auto-generated method stub
		List<InfoMenuListView> infoMenuListViews = ecmsInfoDao.getMaterInfoMenuListView(id, orgId, propId, langId);
	
		for(InfoMenuListView infoMenuListView :infoMenuListViews){
			PictureFrameView pictureFrameView = ecmsMainMenuDao.getPictureFrameViews(orgId, propId, infoMenuListView.getPictureFrameView().getId());
			infoMenuListView.setPictureFrameView(pictureFrameView);
			infoMenuListView.setBranchelList(ecmsInfoDao.getBrachels(infoMenuListView.getId()));
						
		}
		return infoMenuListViews;
	}

	@Override
	public InfoDetailView getInfoDetailView(long orgId, long propId,
			String langId, long id) {
		// TODO Auto-generated method stub
		return ecmsInfoDao.getInfoDetailView(orgId, propId, langId, id);
		
	}

	

	
}
